package kosta.service;

import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;

import kosta.model.dao.AuctionDAO;

import kosta.model.vo.AuctionVO;
import kosta.model.vo.BidVO;
import kosta.model.vo.BigClassVO;
import kosta.model.vo.DeleteConfirmVO;
import kosta.model.vo.ListVO;
import kosta.model.vo.MemberVO;
import kosta.model.vo.PagingBean;
import kosta.model.vo.SearchVO;
import kosta.model.vo.SmallClassVO;

import org.springframework.stereotype.Service;

@Service
public class AuctionServiceImpl implements AuctionService{
	
	@Resource(name="auctionDAOImpl")
	private AuctionDAO auctionDAO;




	@Override
	public AuctionVO findAuctionInfo(int boardNo) {
		auctionDAO.updateHits(boardNo);
		return auctionDAO.findAuctionInfo(boardNo);
	}

	@Override
	public MemberVO findMemberInfo(int memberNo) {
		return auctionDAO.findMemberInfo(memberNo);
	}
	@Override
	public List<BigClassVO> getBigClassList() {
		return auctionDAO.getBigClassList();
	}

	@Override
	public BigClassVO findBigClass(int bigNo) {
		return auctionDAO.findBigClass(bigNo);
	}

	@Override
	public SmallClassVO findSmallClass(int boardNo) {
		return auctionDAO.findSmallClass(boardNo);
	}



	@Override
	public List<SmallClassVO> getSmallClassList(int bigClass) {
		return auctionDAO.getSmallClassList(bigClass);
	}

	@Override
	public ListVO findBySmallClass(SearchVO svo) {
		List<AuctionVO> list=auctionDAO.getAuctionList(svo);
		int total=auctionDAO.getTotalPostingCount(svo);
		PagingBean pagingBean=new PagingBean(total,svo.getPageNo(),svo.getKeyword(),svo.getFlag(),svo.getSmallClassNo());
		
		return new ListVO(list,pagingBean);
	}

	@Override
	public ListVO getAuctionList(SearchVO svo) {
		List<AuctionVO> list=auctionDAO.getAuctionList(svo);
		int total=auctionDAO.getTotalPostingCount(svo);
		PagingBean pagingBean=new PagingBean(total,svo.getPageNo(),svo.getKeyword(),svo.getFlag(),svo.getSmallClassNo());
		return new ListVO(list,pagingBean);	}

	@Override
	public ListVO findByKeyword(SearchVO svo) {
		List<AuctionVO> list=auctionDAO.getAuctionList(svo);
		int total=auctionDAO.getTotalPostingCount(svo);
		PagingBean pagingBean=new PagingBean(total,svo.getPageNo(),svo.getKeyword(),svo.getFlag(),svo.getSmallClassNo());
		return new ListVO(list,pagingBean);
	}
	public void BidRegister(BidVO bvo){
		auctionDAO.bidRegister(bvo);
	}
	public List<BidVO> bid(int boardNo){
		return auctionDAO.bid(boardNo);
	}

	public String priceCheck(BidVO bvo){
		return auctionDAO.priceCheck(bvo);
	}
	@Override
	public AuctionVO findAuctionInfoNotHit(int boardNo) {
		
		return auctionDAO.findAuctionInfo(boardNo);
	}
	public void endBid(AuctionVO avo){
		auctionDAO.endBid(avo);
	}
	public int minbidPrice(int boardNo){
		return auctionDAO.minbidPrice(boardNo);
	}
	public void deleteConfirm(DeleteConfirmVO dcvo){
		auctionDAO.deleteConfirm(dcvo);
	}
	@Override
	public void auctionRegister(AuctionVO avo) {
		auctionDAO.auctionRegister(avo);
	}
	@Override
	public void auctionUpdate(AuctionVO avo) {
	      auctionDAO.auctionUpdate(avo);
	}
	@Override
	public DeleteConfirmVO findDelConfirm(int boardNo){
		return auctionDAO.findDelConfirm(boardNo);
	}

}



